
package neon;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.ListIterator;

public class NeonPainter
{

	private static final Font STD_FONT = new Font("courier new", 1, 20);


	public Graphics g = null;


	public void draw(NeonGroup group)
	{
		ListIterator<NeonButton> ite1 = null;
		ListIterator<NeonLabel> ite2 = null;
		ListIterator<NeonList> ite3 = null;
		NeonButton tempButton = null;
		NeonLabel tempLabel = null;
		NeonList tempList = null;
		
		this.g.setFont(STD_FONT);
		this.g.setColor(Color.GREEN);

		ite1 = group.getButtonIterator();
		while (ite1.hasNext())
		{
			tempButton = ite1.next();
			this.draw(tempButton);
		}

		ite2 = group.getLabelIterator();
		while (ite2.hasNext())
		{
			tempLabel = ite2.next();
			this.draw(tempLabel);
		}

		ite3 = group.getListIterator();
		while (ite3.hasNext())
		{
			tempList = ite3.next();
			this.draw(tempList);
		}
	}

	public void draw(NeonButton nb)
	{
		Graphics2D g2d = (Graphics2D) this.g;

		g2d.draw(nb.getBounds());

		g2d.drawString(nb.getLabel(), nb.getX() + 4, nb.getY() + 20);
	}

	public void draw(NeonLabel nl)
	{
		this.g.drawRect(nl.left, nl.top, nl.getWidth(), nl.getHeight());
	}

	public void draw(NeonList nl)
	{
		Graphics2D g2d = (Graphics2D) this.g;
		
		g2d.draw(nl.getBounds());
		g2d.drawString("ttt", 10, 110);
	}
}
